查询任务状态
API6
这个端点的作用是查询音频生成任务的状态。
路径:/gateway/query
方法:GET
类型:application/json
URL参数 ids:
可以是1个, 例如/gateway/query?ids=song_id1
也可以是2个, 例如/gateway/query?ids=song_id1,song_id2
注意
这里的 song_id1 和 song_id2 必须返回自同一个创建任务请求。
例如 A 请求返回了 id1 和 id2, B 请求返回了 id3 和 id4。 可以是, query?ids=id1,id2, 或者 query?ids=id3,id4。 但不可以是 query?ids=id1,id3。
生成失败
如果生成失败,检查 meta_data 字段,error_type 和 error_message 字段会告诉你失败的原因。
[{
'model_name': 'chirp-v3',
'meta_data': {
'tags': None,
'prompt': '',
'gpt_description_prompt': '写一首歌,朗朗,朗朗上口,朗朗的钢琴。',
'audio_prompt_id': None,
'history': None,
'concat_history': None,
'type': 'gen',
'duration': None,
'refund_credits': None,
'stream': True,
'error_type': 'moderation_failure',
'error_message': 'Song Description contained artist name: lang lang'
},
'reaction': None,
'id': '5cef2a0d-84b2-4390-ad13-82e4fa1c9003',
'is_liked': False,
'created_at': '2024-05-16T08:40:16',
'video_url': '',
'user_id': 'a86b15d2-97be-4cd4-abdc-8e6936225e7b',
'status': 'error',
'audio_url': 'https://cdn1.suno.ai/None.mp3',
'display_name': 'GalvanizingWhiteNoise784',
'title': '',
'image_url': None,
'handle': 'galvanizingwhitenoise784',
'play_count': 0,
'image_large_url': None,
'is_handle_updated': False,
'upvote_count': 0,
'is_video_pending': False,
'is_trashed': False,
'is_public': False,
'major_model_version': 'v3'
}
]
生成中
此时 status 为 streaming, 可以使用 audio_url 提供的地址开始播放。
生成完毕
如果生成成功, 返回的结果如下:
[{
'model_name': 'chirp-v3',
'meta_data': {
'tags': 'happy, rock',
'prompt': 'A happy song about cats',
'gpt_description_prompt': None,
'audio_prompt_id': None,
'history': None,
'concat_history': None,
'type': 'gen',
'duration': 120.0,
'refund_credits': False,
'stream': True,
'error_type': None,
'error_message': None
},
'reaction': None,
'id': 'd2755e7c-d4fa-4d4b-adb1-cec25cc69bda',
'is_liked': False,
'created_at': '2024-04-05T18:37:39',
'video_url': 'https://cdn1.suno.ai/d2755e7c-d4fa-4d4b-adb1-cec25cc69bda.mp4',
'user_id': 'a86b15d2-97be-4cd4-abdc-8e6936225e7b',
'status': 'complete',
'audio_url': 'https://cdn1.suno.ai/d2755e7c-d4fa-4d4b-adb1-cec25cc69bda.mp3',
'display_name': 'GalvanizingWhiteNoise784',
'title': 'Happy Cat Song',
'image_url': 'https://cdn1.suno.ai/image_d2755e7c-d4fa-4d4b-adb1-cec25cc69bda.png',
'handle': 'galvanizingwhitenoise784',
'play_count': 0,
'image_large_url': 'https://cdn1.suno.ai/image_large_d2755e7c-d4fa-4d4b-adb1-cec25cc69bda.png',
'is_handle_updated': False,
'upvote_count': 0,
'is_video_pending': False,
'is_trashed': False,
'is_public': False,
'major_model_version': 'v3'
}]
staus 字段说明
其中 status 可能的值有 submitted, queued, streaming, complete, error。